/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gmovil_jpa.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author castlerock
 */
@Entity
@Table(name = "detalle_factura_plan")
@NamedQueries({
    @NamedQuery(name = "DetalleFacturaPlan.findAll", query = "SELECT d FROM DetalleFacturaPlan d"),
    @NamedQuery(name = "DetalleFacturaPlan.findByIdDetalleFacturaPlan", query = "SELECT d FROM DetalleFacturaPlan d WHERE d.idDetalleFacturaPlan = :idDetalleFacturaPlan"),
    @NamedQuery(name = "DetalleFacturaPlan.findByPrecio", query = "SELECT d FROM DetalleFacturaPlan d WHERE d.precio = :precio"),
    @NamedQuery(name = "DetalleFacturaPlan.findByIva", query = "SELECT d FROM DetalleFacturaPlan d WHERE d.iva = :iva"),
    @NamedQuery(name = "DetalleFacturaPlan.findByDescuento", query = "SELECT d FROM DetalleFacturaPlan d WHERE d.descuento = :descuento"),
    @NamedQuery(name = "DetalleFacturaPlan.findByXidPlanAnterior", query = "SELECT d FROM DetalleFacturaPlan d WHERE d.xidPlanAnterior = :xidPlanAnterior")})
public class DetalleFacturaPlan implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_detalle_factura_plan")
    private Integer idDetalleFacturaPlan;
    @Basic(optional = false)
    @Column(name = "precio")
    private double precio;
    @Basic(optional = false)
    @Column(name = "iva")
    private double iva;
    @Basic(optional = false)
    @Column(name = "descuento")
    private double descuento;
    @Column(name = "xid_plan_anterior")
    private Integer xidPlanAnterior;
    @JoinColumn(name = "fid_tipo_operacion_comercial", referencedColumnName = "id_tipo_operacion_comercial")
    @ManyToOne(optional = false)
    private TipoOperacionComercial tipoOperacionComercial;
    @JoinColumn(name = "fid_plan", referencedColumnName = "id_plan")
    @ManyToOne(optional = false)
    private Plan plan;
    @JoinColumn(name = "fid_factura", referencedColumnName = "id_factura")
    @ManyToOne(optional = false)
    private Factura factura;

    public DetalleFacturaPlan() {
    }

    public DetalleFacturaPlan(Integer idDetalleFacturaPlan) {
        this.idDetalleFacturaPlan = idDetalleFacturaPlan;
    }

    public DetalleFacturaPlan(Integer idDetalleFacturaPlan, double precio, double iva, double descuento) {
        this.idDetalleFacturaPlan = idDetalleFacturaPlan;
        this.precio = precio;
        this.iva = iva;
        this.descuento = descuento;
    }

    public Integer getIdDetalleFacturaPlan() {
        return idDetalleFacturaPlan;
    }

    public void setIdDetalleFacturaPlan(Integer idDetalleFacturaPlan) {
        this.idDetalleFacturaPlan = idDetalleFacturaPlan;
    }

    public double getPrecio() {
        return precio;
    }

    public void setPrecio(double precio) {
        this.precio = precio;
    }

    public double getIva() {
        return iva;
    }

    public void setIva(double iva) {
        this.iva = iva;
    }

    public double getDescuento() {
        return descuento;
    }

    public void setDescuento(double descuento) {
        this.descuento = descuento;
    }

    public Integer getXidPlanAnterior() {
        return xidPlanAnterior;
    }

    public void setXidPlanAnterior(Integer xidPlanAnterior) {
        this.xidPlanAnterior = xidPlanAnterior;
    }

    public TipoOperacionComercial getTipoOperacionComercial() {
        return tipoOperacionComercial;
    }

    public void setTipoOperacionComercial(TipoOperacionComercial tipoOperacionComercial) {
        this.tipoOperacionComercial = tipoOperacionComercial;
    }

    public Plan getPlan() {
        return plan;
    }

    public void setPlan(Plan plan) {
        this.plan = plan;
    }

    public Factura getFactura() {
        return factura;
    }

    public void setFactura(Factura factura) {
        this.factura = factura;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDetalleFacturaPlan != null ? idDetalleFacturaPlan.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleFacturaPlan)) {
            return false;
        }
        DetalleFacturaPlan other = (DetalleFacturaPlan) object;
        if ((this.idDetalleFacturaPlan == null && other.idDetalleFacturaPlan != null) || (this.idDetalleFacturaPlan != null && !this.idDetalleFacturaPlan.equals(other.idDetalleFacturaPlan))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gmovil_jpa.entidades.DetalleFacturaPlan[idDetalleFacturaPlan=" + idDetalleFacturaPlan + "]";
    }

}
